package com.scm.biz.query;

public class BaseQuery {
	private Integer limit = 0;

	private Integer offset = 0;
	
	private Integer pageNo=0;
	
	private Integer pageSize =20;
	
	private Integer pageCount = 0;
	

	private String queryBeginDate;

	private String queryEndDate;
	
	private Integer isSplitPage=0;

	public Integer getLimit() {
		return limit;
	}

	public void setLimit(Integer limit) {
		this.limit = limit;
	}

	public Integer getOffset() {
		return offset;
	}

	public void setOffset(Integer offset) {
		this.offset = offset;
	}

	public String getQueryBeginDate() {
		return queryBeginDate;
	}

	public void setQueryBeginDate(String queryBeginDate) {
		this.queryBeginDate = queryBeginDate;
	}

	public String getQueryEndDate() {
		return queryEndDate;
	}

	public void setQueryEndDate(String queryEndDate) {
		this.queryEndDate = queryEndDate;
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		if(pageNo == null || pageNo == 0){
			pageNo = 1;
		}
		this.pageNo = pageNo;
		this.limit = this.pageSize;
		this.offset = (this.pageNo - 1) * this.pageSize;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getPageCount() {
		
		return this.pageCount;
	}



	public void setRecourdCount(Integer recourdCount) {
		this.pageCount = (recourdCount+pageSize-1)/pageSize;
	
	}

	public String getSplitPage() {
		String splitPage = "";
		splitPage = "<li><a href=\"{url}pageNo=1\">首页</a></li>";
		if(pageNo>1){
			splitPage += "<li><a href=\"{url}pageNo="+(pageNo -1)+"\">上一页</a></li>";
		}else{
			splitPage += "<li><a href=\"#\">上一页</a></li>";
		}
		splitPage = splitPage+"<li><a href=\"javascript:;\" style=\"padding: 0;\"><input type=\"text\" value="+pageNo+"  style=\"border: none; border-bottom: 1px solid #ccc; padding: 4.5px 0; width: 40px;\"/></a></li>";
		if(pageNo<pageCount){
			splitPage += "<li><a href=\"{url}pageNo="+(pageNo +1)+"\">下一页</a></li>";
		}else{
			splitPage += "<li><a href=\"#\">下一页</a></li>";
		}
		splitPage += "<li><a href=\"#\">总"+pageCount+"页</a></li>";
		if(pageNo<pageCount){
			splitPage += "<li><a href=\"{url}pageNo="+(pageCount)+"\">尾页</a></li>";
		}else{
			splitPage += "<li><a href=\"#\">尾页</a></li>";
		}
		return splitPage;
	}


	
}
